<script setup>
const props = defineProps({
  modelValue: {
    required: true
  },
  field: {
    type: String,
    required: true
  },
  label: {
    type: String,
    required: true
  },
  rules: {
    type: Array,
    default: () => []
  },
  disabled: Boolean,
  activeText: String,
  inactiveText: String
})

const emit = defineEmits(['update:modelValue'])
</script>

<template>
  <el-form-item :label="label" :rules="rules" :prop="field">
    <el-switch
        :model-value="modelValue"
        @update:modelValue="emit('update:modelValue', $event)"
        :disabled="disabled"
        :active-text="activeText"
        :inactive-text="inactiveText"
    />
  </el-form-item>
</template>
